;;; emms-settings.el ---
;; -*- Emacs-Lisp -*-

;; Time-stamp: <2010-04-13 02:29:07 Tuesday by Mugua>

;; This  file is free  software; you  can redistribute  it and/or
;; modify it under the terms of the GNU General Public License as
;; published by  the Free Software Foundation;  either version 3,
;; or (at your option) any later version.

;; This file is  distributed in the hope that  it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR  A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You  should have  received a  copy of  the GNU  General Public
;; License along with  GNU Emacs; see the file  COPYING.  If not,
;; write  to  the Free  Software  Foundation,  Inc., 51  Franklin
;; Street, Fifth Floor, Boston, MA 02110-1301, USA.


;;; Commentary:
;;
;; Edit by zuojg

;;; Code:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; EMMS 播放音乐
;; Edit by zuojg
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'emms-setup)
(emms-devel)
;; 播放器
(setq emms-player-mpg321-command-name "mpg123"
      emms-player-mplayer-command-name "mplayer"
      emms-player-list '(emms-player-mpg321
                         emms-player-mplayer-playlist
                         emms-player-ogg123
                         emms-player-mplayer))
;;编码
(setq emms-info-mp3info-coding-system 'gbk
      emms-lyrics-coding-system 'gbk
      emms-cache-file-coding-system 'utf-8)
;;默认的音乐和歌词文件 目录
(setq emms-source-file-default-directory "~/Music/"
      emms-lyrics-dir "~/Music/")
;;模式行显示格式
(setq emms-mode-line-format "[ %s ]"
      emms-lyrics-display-format "%s"
      emms-playing-time-display-format "%s")
(setq global-mode-string
      '("" appt-mode-string
        display-time-string " "
        battery-mode-line-string " "
        erc-modified-channels-object
        emms-mode-line-string " "
        emms-playing-time-string " "

        emms-lyrics-mode-line-string " "))

;;显示设置
(set-face-foreground 'emms-playlist-selected-face "magenta")
(set-face-foreground 'emms-playlist-track-face  "green")
(setq emms-source-file-directory-tree-function
      'emms-source-file-directory-tree-find)
(add-hook 'emms-player-started-hook 'emms-show)
(setq emms-playlist-sort-prefix "S")

(apply-define-key
 global-map
 `(("<f3>" emms-playlist-mode-go-popup)
   ("C-c e t" emms-play-directory-tree)
   ("C-c e x" emms-start)
   ("C-c e v" emms-stop)
   ("C-c e n" emms-next)
   ("C-c e p" emms-previous)
   ("C-c e o" emms-show)
   ("C-c e h" emms-shuffle)
   ("C-c e e" emms-play-file)
   ("C-c e SPC" emms-pause)
   ("C-c e f" emms-no-next)
   ("C-c e a" emms-add-directory-tree)
   ("C-c e r" emms-toggle-repeat-track)
   ("C-c e R" emms-toggle-repeat-playlist)
   ("C-c e m" emms-lyrics-toggle-display-on-minibuffer)
   ("C-c e M" emms-lyrics-toggle-display-on-modeline)
   ("C-c e <left>"  (lambda () (interactive) (emms-seek -10)))
   ("C-c e <right>" (lambda () (interactive) (emms-seek +10)))
   ("C-c e <down>"  (lambda () (interactive) (emms-seek -60)))
   ("C-c e <up>"    (lambda () (interactive) (emms-seek +60)))
   ("C-c e s u" emms-score-up-playing)
   ("C-c e s d" emms-score-down-playing)
   ("C-c e s o" emms-score-show-playing)))

(apply-define-key
 emms-playlist-mode-map
 `(("S s" emms-playlist-sort-by-score)))

;;;###autoload
(defun emms-playlist-mode-jump ()
  "Jump to the directory of track at point in `emms-playlist-buffer'."
  (interactive)
  (dired
   (file-name-directory
    (emms-track-t (emms-playlist-track-at) 'name))))

(provide 'emms-settings)
